package com.accesshollywood.notifications;

import java.util.ArrayList;

import com.accesshollywood.grfxOrdering.basics.Users;
import com.accesshollywood.indexables.GrfxOrder;
import com.accesshollywood.indexables.User;
import com.accesshollywood.speech.Speak;

public class SpokenAlert {
	public static void orderAssigned(GrfxOrder currOrder, User assignee, User assigner) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Assigned to you";
		String body = "Order Number " + currOrder.getId() + " has been assigned to you by " + assigner.getFullName() + ".";
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		// Email.sendEmail(assignee, subject, body);
		Speak.say(body);
	}

	public static void orderUnAssigned(GrfxOrder currOrder, User assignee, User assigner) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Assigned to someone else";
		String body = "Order Number " + currOrder.getId() + " has been unAssigned from you by " + assigner.getFullName() + ".";
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		// Email.sendEmail(assignee, subject, body);
		Speak.say(body);
	}

	public static void orderModified(GrfxOrder oldOrder, GrfxOrder currOrder, User changer) {
		// String subject = "Order # " + oldOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Modified";
		String body = "Order Number " + currOrder.getId() + " has been changed by " + changer.getFullName() + ".\n\n";

		// body += " NEW ORDER:\n" + currOrder.toVerboseString() + "\n\n";
		// body += " OLD ORDER:\n" + oldOrder.toVerboseString() + "\n\n";

		ArrayList<User> toUsers = currOrder.getUsers();

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void textEdited(GrfxOrder currOrder, User changer, String oldText, String newText) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Text Changed";
		String body = "Order Number " + currOrder.getId() + " has been changed by " + changer.getFullName() + ".\n\n";

		// body += " NEW TEXT:\n" + newText + "\n\n";
		// body += " OLD TEXT:\n" + oldText + "\n\n";
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = new ArrayList<User>();
		toUsers.add(currOrder.getArtist());
		toUsers.add(currOrder.getResearcher());
		// toUsers.add(currOrder.getPhotoEdit());
		// toUsers.add(currOrder.getFootage());
		toUsers.add(currOrder.getLegal());
		toUsers.add(currOrder.getProducer());
		toUsers.add(currOrder.getOrderedBy());

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void photosChanged(GrfxOrder currOrder, User changer, String oldPhotos, String newPhotos) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Photos Changed";
		String body = "Order Number " + currOrder.getId() + " has been changed by " + changer.getFullName() + ".\n\n";

		// body += " NEW PHOTOS:\n" + newPhotos + "\n\n";
		// body += " OLD PHOTOS:\n" + oldPhotos + "\n\n";
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = new ArrayList<User>();
		toUsers.add(currOrder.getArtist());
		toUsers.add(currOrder.getResearcher());
		// toUsers.add(currOrder.getPhotoEdit());
		// toUsers.add(currOrder.getFootage());
		toUsers.add(currOrder.getLegal());
		toUsers.add(currOrder.getProducer());
		toUsers.add(currOrder.getOrderedBy());

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void footageChanged(GrfxOrder currOrder, User changer, String oldFootage, String newFootage) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Footage Changed";
		String body = "Order Number " + currOrder.getId() + " has been changed by " + changer.getFullName() + ".\n\n";

		// body += " NEW FOOTAGE:\n" + newFootage + "\n\n";
		// body += " OLD FOOTAGE:\n" + oldFootage + "\n\n";
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = new ArrayList<User>();
		toUsers.add(currOrder.getArtist());
		toUsers.add(currOrder.getResearcher());
		// toUsers.add(currOrder.getPhotoEdit());
		// toUsers.add(currOrder.getFootage());
		toUsers.add(currOrder.getLegal());
		toUsers.add(currOrder.getProducer());
		toUsers.add(currOrder.getOrderedBy());

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void deadlineChanged(GrfxOrder currOrder, User changer, String oldDeadline, String newDeadline) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Deadline Changed";
		String body = "Order Number " + currOrder.getId() + " has been changed by " + changer.getFullName() + ".\n\n";

		// body += " OLD DEADLINE:\n" + oldDeadline + "\n\n";
		// body += " NEW DEADLINE:\n" + newDeadline + "\n\n";
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = currOrder.getUsers();

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void deadlineApproaching(GrfxOrder currOrder) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Deadline Approaching";
		String body = "FRIENDLY REMINDER..";
		// body += "Order Number " + currOrder.getIdOrder() + " is almost due.\n\n";
		// body += currOrder.getDueDate().toString();
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = new ArrayList<User>();
		if (!currOrder.isComplete())
			toUsers.add(currOrder.getArtist());
		if (currOrder.isNeedsResearch() && !currOrder.isApprResearch())
			toUsers.add(currOrder.getResearcher());
		if (currOrder.isNeedsPhotoEdit() && !currOrder.isApprPhotoEdit())
			toUsers.add(currOrder.getPhotoEdit());
		if (currOrder.isNeedsFootage() && !currOrder.isApprFootage())
			toUsers.add(currOrder.getFootage());
		if (currOrder.isNeedsLegal() && !currOrder.isApprLegal())
			toUsers.add(currOrder.getLegal());
		toUsers.add(currOrder.getProducer());
		toUsers.add(currOrder.getOrderedBy());

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void notesChanged(GrfxOrder currOrder, User changer, String oldNotes, String newNotes) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " New Notes";
		String body = "Order Number " + currOrder.getId() + " has has notes added by  " + changer.getFullName() + ".\n\n";

		// body += " OLD NOTES:\n" + oldNotes + "\n\n";
		// body += " NEW NOTES:\n" + newNotes + "\n\n";
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = currOrder.getUsers();

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void researchApproved(GrfxOrder currOrder) {
		// System.out.println("research Approved");
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Research Approved";
		String body = "Order Number " + currOrder.getId() + " has been approved by " + Users.currentUser.getFullName();
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = new ArrayList<User>();
		toUsers.add(currOrder.getArtist());
		toUsers.add(currOrder.getResearcher());
		// toUsers.add(currOrder.getPhotoEdit());
		// toUsers.add(currOrder.getFootage());
		toUsers.add(currOrder.getLegal());
		toUsers.add(currOrder.getProducer());
		toUsers.add(currOrder.getOrderedBy());

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void photoEditApproved(GrfxOrder currOrder) {
		String body = "";
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Photos attached";
		if (currOrder.isApprPhotoEdit()) {
			body = "Order Number " + currOrder.getId() + " has photos attached by " + Users.currentUser.getFullName();
		} else {
			body = "Order Number " + currOrder.getId() + " has had its photos unapproved by " + Users.currentUser.getFullName();
		}
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = new ArrayList<User>();
		toUsers.add(currOrder.getArtist());
		// toUsers.add(currOrder.getResearcher());
		toUsers.add(currOrder.getPhotoEdit());
		// toUsers.add(currOrder.getFootage());
		toUsers.add(currOrder.getLegal());
		toUsers.add(currOrder.getProducer());
		toUsers.add(currOrder.getOrderedBy());

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void footageApproved(GrfxOrder currOrder) {
		String body = "";
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Footage available";
		if (currOrder.isApprFootage()) {
			body = "Order Number " + currOrder.getId() + " has footage available from " + Users.currentUser.getFullName();
		} else {
			body = "Order Number " + currOrder.getId() + " has had its footage removed by " + Users.currentUser.getFullName();
		}
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = new ArrayList<User>();
		toUsers.add(currOrder.getArtist());
		// toUsers.add(currOrder.getResearcher());
		// toUsers.add(currOrder.getPhotoEdit());
		toUsers.add(currOrder.getFootage());
		toUsers.add(currOrder.getLegal());
		toUsers.add(currOrder.getProducer());
		toUsers.add(currOrder.getOrderedBy());

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void legalApproved(GrfxOrder currOrder) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " approved by legal";
		String body = "Order Number " + currOrder.getId() + " has been approved by " + Users.currentUser.getFullName();
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = currOrder.getUsers();

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void markedComplete(GrfxOrder currOrder) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " marked complete";
		String body = "Order Number " + currOrder.getId() + " has been completed by " + Users.currentUser.getFullName() + ".";
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = new ArrayList<User>();
		toUsers.add(currOrder.getArtist());
		// toUsers.add(currOrder.getResearcher());
		// toUsers.add(currOrder.getPhotoEdit());
		// toUsers.add(currOrder.getFootage());
		// toUsers.add(currOrder.getLegal());
		// toUsers.add(currOrder.getProducer());
		toUsers.add(currOrder.getOrderedBy());

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void orderClosed(GrfxOrder currOrder) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Closed";
		String body = "Order Number " + currOrder.getId() + " has been closed.";
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = currOrder.getUsers();

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void orderReopened(GrfxOrder currOrder, User reOpener) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Reopened";
		String body = "Order Number " + currOrder.getId() + " has been reopened by " + reOpener.getFullName() + ".";
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = currOrder.getUsers();

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void orderArchived(GrfxOrder currOrder) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Closed";
		String body = "Order Number " + currOrder.getId() + " has been archived.";
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = currOrder.getUsers();

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}

	public static void orderUnArchived(GrfxOrder currOrder, User reOpener) {
		// String subject = "Order # " + currOrder.getIdOrder() + " (" + currOrder.getSummary() + ") " + " Reopened";
		String body = "Order Number " + currOrder.getId() + " has been unArchived by " + reOpener.getFullName() + ".";
		// body += "\n\nSummary: ["+currOrder.getSummary() +"]";

		ArrayList<User> toUsers = currOrder.getUsers();

		// Email.sendEmail(toUsers, subject, body);
		Speak.say(body);
	}
}
